<!-- 删除模态 -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalTitle" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="关闭"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="deleteModalTitle">警告</h4>
      </div>
      <div class="modal-body">
        <h4 class="text-center">您确定要删除该媒体？</h4>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button ng-disabled="transmitting" ng-click="deleteMedium()" type="button" class="btn btn-danger">确认删除</button>
      </div>
    </div>
  </div>
</div>

<!-- 主体 -->
<div ui-view class="view clearfix">
  <div class="page-header clearfix">
    <ol class="heading">
      <li><a ui-sref="main.media">媒体库</a></li>
    </ol>
  </div>
  <div class="panel panel-default clear-bottom-margin">
    <div class="panel-body table-responsive">
      <table class="table table-hover">
        <thead class="text-center">
          <tr>
            <th>缩略图</th>
            <th>文件名</th>
            <th>描述</th>
            <th>上传日期</th>
            <th>大小</th>
            <th>被引用数</th>
            <th ng-if="editAuth">操作</th>
          </tr>
        </thead>
        <tbody class="text-center text-middle">
          <tr ng-repeat="medium in media">
            <td width="90">
              <div class="list-thumbnail">
                <img ng-if="medium.isImage" ng-src="{{medium | thumbnailSrc}}">
                <div ng-if="!medium.isImage" class="filenamelast">{{medium.fileNameLast}}</div>
              </div>
            </td>
            <td class="text-left"><a href="{{medium.src}}" title="{{medium.fileName}}" target="_blank">{{medium.fileName | words: 20}}</a></td>
            <td>{{!medium.description ? '-' : medium.description | words: 20}}</td>
            <td>{{medium.date | date: 'yyyy年MM月dd日'}}</td>
            <td>{{medium.size / 10000 | number: 0}} KB</td>
            <td>{{medium.quotes.length}}</td>
            <td ng-if="editAuth">
              <button ng-disabled="transmitting" ng-click="$parent.$parent.$parent.deleteMediumId = medium._id" class="btn btn-default btn-xs" type="button" data-toggle="modal" data-target="#deleteModal"><i class="fa fa-trash-o"></i> 删除</button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
  <nd-pagination current-page="$parent.currentPage" total-pages="$parent.totalPages" class="pull-right"></nd-pagination>
</div>